home *** CD-ROM | disk | FTP | other *** search
- Path: res.com!usenet
- From: danlynes@res.com
- Newsgroups: comp.lang.c
- Subject: Re: Segmentation fault at return statement. Can't figure out ....
- Date: 20 Jan 1996 10:40:35 GMT
- Organization: RES Online
- Message-ID: <4dqgr3$626@clare.res.com>
- References: <4dm2n1$egk@murphy.servtech.com>
- Reply-To: danlynes@res.com
- NNTP-Posting-Host: di007.res.com
- X-Newsreader: IBM NewsReader/2 v1.2.5
-
- In <4dm2n1$egk@murphy.servtech.com>, Avijit Dasgupta <avi@servtech.com> writes:
-
- >83: return(999); <----- Segmentation fault at this stmt.
- >}
- >
- >Running dbx I get these error messages:
- >
- >(dbx) where
- >=> [1] test( ) at line 83
- >dbx: bad data address
- >dbx fetch at 0x697075a4 failed - I/O error
- >dbx : attempt to read stack failed - bad frame pointer
- >(dbx)
- >
- >I can't figure out, bcoz this function gets called multiple times and
- >fails only after a fixed X times ... Any Help ?
-
- My guess would be that you're allocating some memory that you're
- not freeing up, when returning from the function. So, after so
- many calls to it, your stack gets filled up, and refuses to
- continue running. i.e. You have a stack overflow error. Try
- proofing your code, to see if there's any memory you're
- forgetting to deallocate, either by by explicitly allocated
- memory, or implicitly allocated memory. One common cause, is
- that some C programmers forget that strdup implicitly calls
- malloc, and as a result, forget to deallocate the allocated
- memory.
-
- However, you might have other problems specific to UNIX. In
- which case, I'm afraid I can't be of any help, but you might look
- to comp.unix.programmer for solutions in that case.
-
- +------------------------------------------------------+
- ! OS/2 - The Champion of Operating Systems !
- ! Enitharmon/2 - A Powerful BBS Package !
- ! What a great pair! danlynes@res.com !
- ! www.res.com/~danlynes/index.html !
- ! www.res.com/~danlynes/Enitharmon!2/index.html !
- ! The Enitharmon Beta project is now under way. !
- ! To subscribe to the mailing list, send e-mail to !
- ! danlynes@res.com or daniel.lynes@ideasnet.com !
- +------------------------------------------------------+
-
-